/**
 * @Description: 接口文档
 * @Author: yuhao 1262172637@qq.com
 * @Date: 2024-03-02 10:58:13
 * @LastEditors: yuhao 1262172637@qq.com
 * @LastEditTime: 2024-03-02 11:03:22
 * @FilePath: /uniapp-android-pda-demo/request/api/index.js
 */
import HttpRequest from '@/request/request.js';
import { APIURL } from '@/utils/env.js';

/* 上传 */
export const upload = (filePath, uploadUrl) => {
	return new Promise((resolve, reject) => {
		let token = "Bearer ";
		token += uni.getStorageSync('token');
		let a = uni.uploadFile({
			url: APIURL + uploadUrl, // 接口地址
			filePath: filePath,
			name: 'multipartFile', // 此处默认值是file,实际需要根据后端接口做更改
			header: {
				'Content-Type': 'multipart/form-data',
				'Authorization': token
			},
			success: (res) => {
				let parseData = JSON.parse(res.data);
				console.log("上传成功的地址", parseData);
				resolve(parseData.data);
			}
		});
	})
}

// 评价工单
export const evaluateOrder = function(data) {
	return HttpRequest('/public/orderInfo/evaluateOrder', 'post', data);
}

// 通过工单id回溯历史
export const queryOrderBackTrack = function(data) {
	return HttpRequest('/public/orderInfo/queryOrderBackTrack', 'post', data, 'application/x-www-form-urlencoded');
}